﻿using System;
using System.Data;
using msBsc.AppLogic.DataAlc;

namespace msBsc.WebUi.CustomerSys
{
    public partial class wfSysHtIndex : msBsc.Cls.BPProxy
    {
        //CBizShpCommercialTenantInfo objShpCommercialTenantInfo = new CBizShpCommercialTenantInfo();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindControls();
            }
        }

        private void BindControls()
        {
            if (!IsPostBack)
            {
                using (msBsc.AppLogic.DataAlc.CBizCustomerViews objCBizCustomerViews = new CBizCustomerViews())
                {
                    DataSet ds = objCBizCustomerViews.GetClickInfoByTime("", "", "");
                    string retJson = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "", 1, 500, "");
                    this.ExecJScript(@"
                            var _html = $('#svc_click_count').html();

                            laytpl(_html).render(" + retJson + @", function (render) {
                                $('#clickinfo').html(render);
                            });");
                }
            }
        }

        private void getClickInfo()
        {
            using (msBsc.AppLogic.DataAlc.CBizCustomerViews objCBizCustomerViews = new CBizCustomerViews())
            {
                DataSet ds = objCBizCustomerViews.GetClickInfoByTime("", "", "");
                string retJson = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "", 1, 500, "");
                this.ExecJScript(@"
                            var _html = $('#svc_click_count').html();

                            laytpl(_html).render(" + retJson + @", function (render) {
                                $('#clickinfo').html(render);
                            });");
            }
        }

        public override void DoAction()
        {
            if (this.strAction=="getClickInfo")
            {
                getClickInfo();
            }
        }

    }
}